﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharedGenomics.Domain
{
    //TODO: add tests for this class...
    public class WiggleElement : IComparable<WiggleElement>
    {
        public int Chromosome { get; private set; }
        public long LowerBound { get; private set; }
        public long UpperBound { get; private set; }
        public double Value { get; private set; }

        public WiggleElement(int chromosome, long lowerBound, long upperBound, double value)
        {
            this.Chromosome = chromosome;
            this.LowerBound = lowerBound;
            this.UpperBound = upperBound;
            this.Value = value;
        }

        #region IComparable<WiggleElement> Members

        int IComparable<WiggleElement>.CompareTo(WiggleElement other)
        {
            //return (this.Chromosome == other.Chromosome) ?
            //    (int)(this.LowerBound - other.LowerBound) :
            //    this.Chromosome.CompareTo(other.Chromosome);

            if (this.Chromosome == other.Chromosome)
                return (int)(this.LowerBound - other.LowerBound);
            return this.Chromosome.CompareTo(other.Chromosome);
        }

        #endregion
    }
}
